//
//  StringExtension.swift
//  SwiftDemo1
//
//  Created by wzp on 2025/6/22.
//

import Foundation

extension String {
    func subString(from startString: String, to endString: String) -> String? {
        guard let startRange = self.range(of: startString),
              let endRange = self.range(of: endString) else {
            return nil
        }
        
        let startIndex = startRange.upperBound
        let endIndex = endRange.lowerBound
        if startIndex > endIndex {
            return nil
        }
        return String(self[startIndex..<endIndex])
    }
}
